import _00GraphFuc as gf
import _00GraphTreeFuc as gt

#12.4.2构建霍夫曼树
W=[[0.08,'a'],[0.10,'b'],[0.12,'c'],[0.15,'d'],[0.20,'e'],[0.35,'f']]
tree=sorted(W)
print(tree)
while len(tree)!=1:
    tree=[[tree[0][0]+tree[1][0],tree[0],tree[1]]]+tree[2:]
    tree=sorted(tree)
    print(tree)